<HTML>
<HEAD>
<SCRIPT>var isomorphicDir="../isomorphic/";</SCRIPT>
<SCRIPT src="../isomorphic/system/development/ISC_Core.js"></SCRIPT>
<SCRIPT src="../isomorphic/system/development/ISC_Foundation.js"></SCRIPT>
<SCRIPT src="../isomorphic/system/development/ISC_Containers.js"></SCRIPT>
<SCRIPT src="../isomorphic/system/development/ISC_Grids.js"></SCRIPT>
<SCRIPT src="../isomorphic/system/development/ISC_Forms.js"></SCRIPT>
<SCRIPT src="../isomorphic/system/development/ISC_DataBinding.js"></SCRIPT>
<SCRIPT src="../isomorphic/skins/Enterprise/load_skin.js"></SCRIPT>
<script type="text/javascript">
  var OB = {};
  OB.Format = {};
  OB.Format.date = "dd-MM-yyyy";
  OB.Constants = "";
</script>
<script src="../../org.openbravo.client.application/js/ob-utilities.js" type="text/javascript"></script>
<script src="../../org.openbravo.client.application/js/ob-formitem-widgets.js" type="text/javascript"></script>
<SCRIPT src="../isomorphic/login/reloginFlow.js"></SCRIPT>
</HEAD>
<BODY>
<script>


isc.DynamicForm.create({
    ID: "exampleForm",
    //validateOnChange : true,
    width: 250,
    fields: [{
      name: "SC 8.0 DateItem",
      title: "SC 8.0 DateItem",
      type: "DateItem",
      useTextField : true,
      useMask: true,
      maskDateSeparator : "-",
      displayFormat: "toEuropeanShortDate", // http://www.smartclient.com/docs/7.0rc2/a/b/c/go.html#type..DateDisplayFormat
      required: true
    },{
      name: "SC 8.0 DateTimeItem",
      title: "SC 8.0 DateTimeItem",
      type: "DateTimeItem",
      useTextField : true,
      useMask: true,
      maskDateSeparator : "-",
      displayFormat: "toEuropeanShortDate", // http://www.smartclient.com/docs/7.0rc2/a/b/c/go.html#type..DateDisplayFormat
      required: true
    },{
      title: "%d-%m-%Y",
      type: "OBDateItem",
      dateFormat: "%d-%m-%Y",
      required: true
    },{
      name: "username2",
      title: "%d-%m-%y",
      type: "OBDateItem",
      dateFormat: "%d-%m-%y",
      required: false
    },{
      name: "username3",
      title: "%d-%m-%Y %H:%M",
      type: "OBDateItem",
      dateFormat: "%d-%m-%Y %H:%M",
      required: false
    },{
      name: "username4",
      title: "%d-%m-%y %H:%M",
      type: "OBDateItem",
      dateFormat: "%d-%m-%y %H:%M",
      required: false
    },{
      name: "username5",
      title: "%d-%m-%Y %H:%M:%S",
      type: "OBDateItem",
      dateFormat: "%d-%m-%Y %H:%M:%S",
      required: false
    },{
      name: "username6",
      title: "%d-%m-%y %H:%M:%S",
      type: "OBDateItem",
      dateFormat: "%d-%m-%y %H:%M:%S",
      required: false
    }]
});



isc.Button.create({
    top: 250,
    title: "Validate",
    click: "exampleForm.validate()"
});




/*
 
Date.setShortDisplayFormat(function () {
    var dateObj = this.getDate() + "/" + (this.getMonth() + 1) + "/" + this.getShortYear();
    return dateObj;

});

function test() {

var pepe = new Date(2005,1,4);
pepe = pepe.toString();
alert(Date.parseInput('05/05/05'));


Date.setShortDisplayFormat(function () {
    return this.getDate() + "-" + (this.getMonth() + 1) + "-" + this.getShortYear();
});

  employeeForm.setValue('hireDate',new Date(2005,1,4));

Date.setShortDisplayFormat(function () {
    return this.getDate() + "x" + (this.getMonth() + 1) + "x" + this.getShortYear();
});

Date.setInputFormat('YMD');


 // employeeForm.getField('hireDate').setShortDisplayFormat(
  //  function () { return this.getDate() + "-" + (this.getMonth() + 1) + "-" + this.getShortYear();}
  //);
}

isc.DataSource.create({
    ID:"employees",
    clientOnly:true,
    fields:[
        {name:"employeeID", type:"sequence", hidden:true, primaryKey:true},
        {name:"name", title:"Name"},
        {name:"hireDate", title:"Hiring Date", type:"zipCodeUS"}
    ],
    testData:[
        {employeeID:452, name:"Gene Porter", hireDate:new Date(2005,1,4)},
        {employeeID:782, name:"Cheryl Pearson", hireDate:new Date(2007,11,6)},
        {employeeID:751, name:"Rogine Leger", hireDate:new Date(2007,10,22)},
    ]
})

isc.ListGrid.create({
    ID:"employeeGrid",
    width:250, height:100,
    canEdit:true,
    dataSource:"employees",
    autoFetchData:true,
    recordClick:"employeeForm.editRecord(record)"
})

isc.DynamicForm.create({
    ID:"employeeForm",
    top:150,
    dataSource:"employees",
    fields:[
        {name:"name"},
        {name:"hireDate", useTextField:true},
        {type:"button", title:"Save Edits", click:"test()"}
    ]
    
})*/
</script>

</BODY>
</HTML>
